﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ActiveReportsDemo.Viewers
{
    public partial class TitleControl : UserControl
    {
        public TitleControl()
        {
            InitializeComponent();
        }

        public Image TitleImage
        {
            get { return this.pictureBox1.Image; }
            set { this.pictureBox1.Image = value; }
        }

        public string TitleText
        {
            get { return this.button1.Text; }
            set { this.button1.Text = value; }
        }

        public Color TitleBackColor
        {
            get { return this.BackColor; }
            set
            {
                this.BackColor = value;
            }
        }

        public string ReportCategory
        { get; set; }

        public string ReportName
        { get; set; }

        public EventHandler TitleClicked;

        private int dis = 1;
        
        private void TitleControl_MouseDown(object sender, MouseEventArgs e)
        {
            this.PerformLayout();
            this.Location = new Point(this.Location.X + dis, this.Location.Y + dis);
            this.Size = new Size(this.Size.Width - dis * 2, this.Size.Height - dis * 2);
            this.ResumeLayout(true);
        }

        private void TitleControl_MouseUp(object sender, MouseEventArgs e)
        {
            this.PerformLayout();
            this.Location = new Point(this.Location.X - dis, this.Location.Y - dis);
            this.Size = new Size(this.Size.Width + dis * 2, this.Size.Height + dis * 2);
            this.ResumeLayout(true);
        }

        private void TitleControl_Click(object sender, EventArgs e)
        {
            if (TitleClicked != null)
            {
                TitleClicked(this, e);
            }
        }

    }
}
